CREATE PROCEDURE coreWFProcessStartDeleteByID
(
	@id	int
)
AS
	DECLARE @DeletedRank int;
	DECLARE @ProcessID int;
	SELECT @DeletedRank=Rank, @ProcessID=FK_ProcessID FROM WFProcessStart WHERE PK_ID=@id;
	
	IF NOT @DeletedRank IS NULL
	BEGIN
		DELETE FROM WFProcessStart WHERE PK_ID=@id;
		UPDATE WFProcessStart SET Rank=Rank-1 WHERE FK_ProcessID=@ProcessID AND Rank>@DeletedRank;
	END


